#ifndef MKFILESETTINGS_H
#define MKFILESETTINGS_H

#include "mksettings.h"

#include <QtXml/QDomElement>
#include <QMap>

class MKFileSettings : public QDomDocument, MKSettings
{
public:
	explicit MKFileSettings(const QString &fileName = "../dat/settings.xml");
	virtual ~MKFileSettings();
	bool save();
	bool isValid() { return mIsValid; }
	QString lastError() { return mLastError; }

	virtual QString typeRuName(const quint8 &typeId);
	virtual QString categoryRuName(const quint8 &typeId, const quint8 &categoryId);

	virtual QList<quint8> categoriesByType(const quint8 &typeId);

	virtual QList<QPair<quint8, QString> > typesParameters();
	virtual QList<QPair<quint8, QString> > typeCategoriesParameters(const quint8 &typeId);

	virtual bool addCategory(const quint8 &typeId, const QString &categoryRuName, const QString &categoryEngName);

	QMap<QString, QString> databaseParameters();

private:
	QDomElement type(quint8 typeId);
	QDomElement category(quint8 typeId, quint8 categoryId);
	QDomElement database();

	QString mFilename;
	QDomElement mRoot;
	QString mLastError;
	bool mIsValid;
};

#endif // MKFILESETTINGS_H
